/**
 * @File Name: common.h
 * @brief  
 *  一些公共定义
 * @Author : LiWanglin email:lwl510ll@163.com
 * @Version : 1.0
 * @Creat Date : 2023-07-11
 * 
 * @copyright Copyright (c) 2023 LiWanglin
 */

#ifndef COMMON_COMMON_H
#define COMMON_COMMON_H

#ifdef __cplusplus
extern "C"
{
#endif

/*
    变量类型定义
*/
typedef unsigned char cm_uint8;
typedef char cm_int8;
typedef short unsigned int cm_uint16;
typedef short int cm_int16;
typedef unsigned int cm_uint32;
typedef int cm_int32;
typedef long unsigned int cm_uint64;
typedef long int cm_int64;

/*
    错误码定义
*/
typedef enum _err_code {
    err_ok = 0x00,
    err_malloc_failed = -1,
    err_point_null = -2,
    err_data_len = -3,
    err_no_header = -4,
    err_len_not_enough = -5,
    err_crc = -6
}err_code;

/*
    bool 定义
*/
typedef enum _bool {
    cm_false = 0x00,
    cm_true
} cm_bool;

cm_uint8 check_code_calculation(cm_uint8 *data, cm_uint16 len);

#ifdef __cplusplus
}
#endif

#endif /* COMMON_COMMON_H */